package com.test.controller;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;


@RestController
@RefreshScope
public class IndexController implements InitializingBean {

    @Value("${user.age}")
    private String age;
    @Value("${user.name}")
    private String name;

    @Value("${login.name}")
    private static String loginName;

    /**文件存储目录*/
    public static String SAVE_PATH = null;

    @Value("${local.file.temp.dir}")
    public  String  SAVE_PATH_TEMP;




    @GetMapping("test")
    public void test(){

        System.out.println(SAVE_PATH);
    }

    @GetMapping("/index")
    public String hello() {
        return name+","+age;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        SAVE_PATH = SAVE_PATH_TEMP;
    }
}
